﻿
Imports managedServer
Imports storoomc

Public Class configDelegate
    Inherits requestProcessor

    Private Shared _idsysUrl As String = Nothing
    Private Shared _ocUrl As String = Nothing

    Public Overrides Sub initial(Optional ByVal config As configParser = Nothing)
        MyBase.initial(config)
        assert(Not config Is Nothing)
        assert(storoom.initial(config, configNaming.cache.section))
        lpmsengi.initial(config)
        initialCache(config.parameter(configNaming.avatar.section,
                                      configNaming.avatar.cachesize,
                                      configNaming.defaultValue.avatar.cachesize))
        initialOcCtx(config.parameter(configNaming.avatar.section,
                                      configNaming.avatar.ocurl,
                                      configNaming.defaultValue.avatar.ocurl))
        initialIdCtx(config.parameter(configNaming.avatar.section,
                                      configNaming.avatar.idurl,
                                      configNaming.defaultValue.avatar.idurl),
                     config.parameter(configNaming.avatar.section,
                                      configNaming.avatar.idctxid,
                                      configNaming.defaultValue.avatar.idctxid),
                     config.parameter(configNaming.avatar.section,
                                      configNaming.avatar.idctxpwd,
                                      configNaming.defaultValue.avatar.idctxpwd))
        loosenSPMLimit(ProHttpS.processorHttpServer().threadCount())
    End Sub

    Public Overrides Function pathidentity() As String
        Return "__INVALID_PATH__"
    End Function

    Public Overrides Function process(ByVal context As httpContext) As Boolean
        Return debugassert(False)
    End Function
End Class

Namespace configNaming
    Namespace avatar
        Public Module _avatar
            Public Const section As String = "avatar"
            Public Const cachesize As String = "cachesize"
            Public Const ocurl As String = "ocurl"
            Public Const idurl As String = "idurl"
            Public Const idctxid As String = "idctxid"
            Public Const idctxpwd As String = "idctxpwd"
        End Module
    End Namespace

    Namespace cache
        Public Module _cache
            Public Const section As String = "cache"
        End Module
    End Namespace

    Namespace defaultValue
        Namespace avatar
            Public Module _avatar
                Public Const cachesize As Int64 = 1024
                Public Const ocurl As String = "http://oc.hzj-jie.net/"
                Public Const idurl As String = "http://id.hzj-jie.net/"
                Public Const idctxid As String = "site_avatar"
                Public Const idctxpwd As String = "8d0b0431-ccc4-4376-809c-3d5ac0a5e2b9"
            End Module
        End Namespace
    End Namespace
End Namespace
